package com.iwhalecloud.bss.kite.cucc.service.util;

import com.iwhalecloud.bss.kite.common.util.KiteMapUtils;

import java.util.List;
import java.util.Map;

/**
 * 下划线转驼峰
 * @author wuguoyuan
 * @date 2019-11-08 16:47:29
 */
public class FieldTransformUtil {

  /**
   * 1.驼峰转下划线
   * 2.下划线转驼峰
   * @param list
   * @param i
   * @return
   */
  public static <T> List<Map<String, T>> transfrom(List<Map<String, T>> list, int i) {
    if (list == null || list.size() == 0) {
      return list;
    }
    
    for (Map<String, ?> map : list) {
      if (i == 1) {
        KiteMapUtils.camelToUnderline(map);
      }
      else if (i == 2) {
        KiteMapUtils.underlineToCamel(map);
      }
    }
    
    return list;
  }

}
